home *** CD-ROM | disk | FTP | other *** search
/ Digit Magazine 1999 December / cDigit issue 18 - December 1999.iso / pc / demos / XMLwriter 1.0 Beta shareware / data1.cab / Example_Files / Projects / Examples / Library / Library.xsl < prev    next >
Encoding:
Extensible Markup Language  |  1999-08-19  |  3.1 KB  |  122 lines

  1. <?xml version='1.0'?>
  2. <xsl:stylesheet
  3.     xmlns:xsl="http://www.w3.org/TR/WD-xsl"
  4.     xmlns="http://www.w3.org/TR/REC-html40"
  5.     result-ns="">
  6. <!--
  7.     Copyright 1999 Wattle Software
  8.     This XSL stylesheet is based on stylesheet support found in
  9.     Microsoft Internet Explorer 5.
  10.     Use at your own risk!
  11. -->
  12.  
  13. <!-- default rule -->
  14.  
  15. <xsl:template><xsl:apply-templates/></xsl:template>
  16.  
  17. <!-- root rule -->
  18. <xsl:template match="/">
  19. <!-- Build the HTML page -->
  20.     <html>
  21.         <head>
  22.         <!-- Put something useful into the Title -->
  23.         <title><xsl:value-of select="/library/name"/></title>
  24.         </head>
  25.         <body>
  26.             <H1><xsl:value-of select="/library/name"/></H1>
  27.             <H2>Catalog Listing</H2>
  28.             <BLOCKQUOTE>
  29.                 <H3>Books:</H3>
  30.                     <BLOCKQUOTE>
  31.                         <!-- This template selects all the book elements -->
  32.                         <xsl:apply-templates select="/library/book"/>
  33.                     </BLOCKQUOTE>
  34.                 <H3>Journals:</H3>
  35.                     <BLOCKQUOTE>
  36.                         <!-- This template selects all the journal elements -->
  37.                         <xsl:apply-templates select="/library/journal"/>
  38.                     </BLOCKQUOTE>
  39.                 <H3>Videos:</H3>
  40.                     <BLOCKQUOTE>
  41.                         <!-- This template selects all the video elements -->
  42.                         <xsl:apply-templates select="/library/video"/>
  43.                     </BLOCKQUOTE>
  44.             </BLOCKQUOTE>
  45.         </body>
  46.     </html>
  47. </xsl:template>
  48.  
  49. <xsl:template match="book">
  50. <!-- Lets make the title link to the online URL -->
  51.     <EM><A><xsl:attribute name="href">
  52.     <xsl:value-of select="online_url"/>
  53.     </xsl:attribute>
  54.     <xsl:apply-templates select="title"/>
  55.     </A></EM><BR/><BR/>
  56. <!-- Create a table for the other details -->
  57.     <TABLE BORDER="1" CELLPADDING="10">
  58.         <TR>
  59.             <TD><B>Author(s):</B></TD>
  60.             <TD><xsl:apply-templates select="author"/></TD>
  61.         </TR>
  62.         <TR BGCOLOR="#CCCCFF"> <!-- add a bit of colour :) -->
  63.             <TD><B>Call No:</B></TD>
  64.             <TD><xsl:apply-templates select="callno"/></TD>
  65.         </TR>
  66.     </TABLE><BR/>
  67. </xsl:template>
  68.  
  69. <xsl:template match="video">
  70.     <EM><xsl:apply-templates select="title"/></EM><BR/><BR/>
  71. <!-- Create a table for the details -->
  72.     <TABLE BORDER="1" CELLPADDING="10">
  73.         <TR>
  74.             <TD><B>Director:</B></TD>
  75.             <TD><xsl:apply-templates select="director"/></TD>
  76.         </TR>
  77.         <TR BGCOLOR="#CCCCFF">
  78.             <TD><B>Call No:</B></TD>
  79.             <TD><xsl:apply-templates select="callno"/></TD>
  80.         </TR>
  81.     </TABLE>
  82. </xsl:template>
  83.  
  84. <xsl:template match="journal">
  85.     <EM><xsl:apply-templates select="title"/></EM><BR></BR>
  86.     Date of Publication: <xsl:apply-templates select="date"/><BR></BR>
  87.     <TABLE BORDER="1" CELLPADDING="10">
  88.         <TR BGCOLOR="#CCCCFF">
  89.             <TD><B>Call No:</B></TD>
  90.             <TD ALIGN="CENTER"><xsl:apply-templates select="callno"/></TD>
  91.         </TR>
  92.     </TABLE>
  93. </xsl:template>
  94.  
  95. <xsl:template match="title">
  96.     <xsl:value-of/> <!-- insert the element content -->
  97. </xsl:template>
  98.  
  99. <xsl:template match="first-name">
  100.     <xsl:value-of/>
  101. </xsl:template>
  102.  
  103. <xsl:template match="last-name">
  104.     <xsl:value-of/><BR/>
  105. </xsl:template>
  106.  
  107. <xsl:template match="name">
  108.     <xsl:value-of/><BR/>
  109. </xsl:template>
  110.  
  111. <xsl:template match="date">
  112.     <xsl:value-of/>
  113. </xsl:template>
  114.  
  115. <xsl:template match="callno">
  116.     <FONT FACE="courier new">
  117.     <xsl:value-of/>
  118.     </FONT>
  119. </xsl:template>
  120.  
  121. </xsl:stylesheet>
  122.